package com.ermace.robo.jumper.game.Kill;


public enum Combo {
	NONE(0, "", -1),							// ordinal = 0
	SINGLE_KILL(0, "", -1),						// ordinal = 1
	DOUBLE_KILL(10, "Double Kill!", -1),		// ordinal = 2
	TRIPLE_KILL(15, "Triple Kill!", -1),		// ordinal = 3
	MAX(0, "", -1);
	
	private static int numberMax = 0;
	
	/**
     * Geeft de waarde van de enumeratie terug die hoort bij het
     *  gegeven getal of de maximum combo als de waarde groter is
     *  dan de hoogste combo.
     */
	public static Combo getByOrdinal(int ordinal) {
		if (ordinal >= (Combo.values().length - 1) )
			numberMax ++;
		else
			numberMax = 0;
			
		return Combo.values()[Math.min(Math.abs(ordinal), Combo.values().length - 1)];
	}
	
	private final int score;
	private final String text;
	private final int soundId; 
	
	private Combo(int score, String text, int soundId) {
		this.score = score;
		this.text = text;
		this.soundId = soundId;
	}

	/**
	 * @return the score
	 */
	public int getScore() {
		return score;
	}

	public int getComboMultiplier() {
		if (ordinal() == 0)
			return 1;
		else if (ordinal() == (Combo.values().length - 1) )
			return numberMax;
		
		return ordinal();
	}

	/**
	 * @return the text
	 */
	@Override
	public String toString() {
		return text;
	}

	/**
	 * @return the soundId.
	 * 		   -1 if the combo does not have a sound
	 */
	public int getSoundId() {
		return soundId;
	}
}
